#include "Variant.h"


Variant::Variant()
{
}
Variant::Variant(const Variant& Var)
{
	_type = Var._type;
	memcpy(&_value,&Var._value,sizeof _value);
	_value = Var._value;
}
Variant::Variant(const bool& Var)
{
	_type = T_BOOL;
	_value.b = Var;
}
Variant::Variant(const int& Var)
{
	_type = T_INT;
	_value.n = Var;
}
Variant::Variant(const double& Var)
{
	_type = T_DOUBLE;
	_value.d = Var;
}
Variant::~Variant(void)
{

}
Variant& Variant::operator=(const Variant& Var)
{
	_type = Var._type;
	memcpy(&_value,&Var._value,sizeof _value);
	_value = Var._value;
	return *this;
}
Variant& Variant::operator=(const bool& Var)
{
	_type = T_BOOL;
	_value.b = Var;
	return *this;
}
Variant& Variant::operator=(const int& Var)
{
	_type = T_INT;
	_value.n = Var;
	return *this;
}
Variant& Variant::operator=(const double& Var)
{
	_type = T_DOUBLE;
	_value.d = Var;
	return *this;
}

bool Variant::operator==(Variant& Var)
{
	return memcmp(&Var,this,sizeof Variant);
}
bool Variant::operator!=(Variant& Var)
{
	return !operator==(Var);
}

Variant::operator bool()
{
	return _value.b;
}
Variant::operator int()
{
	return _value.n;
}
Variant::operator double()
{
	return _value.d;
}